home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ABUSESRC.ZIP / AbuseSrc / imlib / port / dos4gw / monoprnt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-23  |  766 b   |  46 lines

  1. #include <stdio.h>
  2. #include <mem.h>
  3. #include <dos.h>
  4. #include <stdarg.h>
  5.  
  6. #define v_mem() ((unsigned char *)0xb0000)
  7.  
  8. int mcx=0,mcy=0;
  9. void mnclear()
  10. { memset(v_mem(),0,160*25); }
  11.  
  12.  
  13. void mnprintf(const char *format, ...)
  14. {
  15.   char st[200],a,*sp;
  16.   int y;
  17.   va_list ap;
  18.   va_start(ap, format);
  19.   vsprintf(st,format,ap);
  20.   va_end(ap);
  21.   sp=st;
  22.   while (*sp)
  23.   { a=0;
  24.     if (*sp=='\n')
  25.       a=1;
  26.     else { if (mcx==79)
  27.          a=1;
  28.        *(v_mem()+mcy*160+mcx*2)=*sp;
  29.        *(v_mem()+mcy*160+mcx*2+1)=27;
  30.        mcx++; }
  31.     if (a)
  32.     {
  33.       mcx=0;
  34.       mcy++;
  35.       if (mcy==25)
  36.       {
  37.     for (y=0;y<24;y++)
  38.       memcpy(v_mem()+(y)*160,v_mem()+(y+1)*160,160);
  39.     memset(v_mem()+24*160,0,160);
  40.     mcy=24;
  41.       }
  42.     }
  43.     sp++;
  44.   }
  45. }
  46.